from flask  import Flask,url_for

app = Flask(__name__)
app.config.update({
    'DEBUG': True,
    'TEMPLATES_AUTO_RELOAD': True
})


@app.route('/',endpoint='index')
def Index():
    # print(url_for('practice'))
    return "欢迎来到Flask视图首页"


def my_list():
    return "我是列表页"

app.add_url_rule('/list/',endpoint='practice',view_func=my_list)

# 上下文管理器
with app.test_request_context():
    print(url_for('index'))

if __name__ == "__main__":
    app.run(debug=True)